home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Technology Seed / ADC Seed CD - July 1999.toast / USB / Mac OS USB DDK v1.2 / Examples / USBModem / ModemDriver.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-04-15  |  2.6 KB  |  95 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        ModemDriver.h
  3.  
  4.     Contains:    Definitions for the USB Modem Driver
  5.  
  6.     Version:    xxx put version here xxx
  7.  
  8.  
  9.  
  10.  
  11. */
  12.  
  13. #ifndef    _MODEMDRIVER_
  14. #define    _MODEMDRIVER_
  15.  
  16. typedef struct{
  17.     USBPB                         pb;
  18.     UInt8                         *errorString;
  19.     USBConfigurationDescriptor     *conf;
  20.     USBInterfaceDescriptor         *interface;
  21.     UInt32                         interfaceOffset;
  22.     USBDeviceRef                 deviceRef;
  23.     USBPipeRef                     bulkIn;
  24.     USBPipeRef                     bulkOut;
  25.     USBInterfaceDescriptor         *clinterface;
  26.     UInt32                         clinterfaceOffset;
  27.     USBPipeRef                     interrupt;
  28.     USBDeviceDescriptorPtr        deviceDescriptor;
  29.     UInt8                        modemStatus;
  30.     UInt8                        lineStatus;
  31.     UInt8                         onError;
  32.     UInt8                         retries;
  33.     Boolean                        DTRClose;            // true means don't negate DTR
  34.     UInt16                        modemUSBStatus;        // Modem and line status USB
  35.     UInt16                        lineState;            // Current USB line state
  36.     LineParms                    Line_Settings;        // USB current line settings    
  37.     } serPB;
  38.  
  39. enum{
  40.     kReset = 0,
  41.     kStartConfig = 1,
  42.     kGetConfig = 2,
  43.     kGetDataInterface = 3,
  44.     kGetEndpoint = 4,
  45.     kGetCommInterface = 5,
  46.     kConfigDone = 6,
  47.     kEndpointStall = 1,
  48.     kStallDone = 2,
  49.     kAvailableStatus = 'okok'
  50.     };
  51.  
  52. /********************************************************************************************/
  53. //
  54. //    Prototypes
  55. //
  56. /********************************************************************************************/
  57.  
  58. static         Boolean immediateError(OSStatus err);
  59. static void ConfigurationHandler(USBPB *pb);
  60. static void ResetInterruptPB(USBPB *pb);
  61. static void interruptCompletion(USBPB *pb);
  62. static void StartStatusMonitor(USBPipeRef interruptPipe);
  63. static void syncCompletion(USBPB *pb);
  64. Boolean     TimeoutPrevRequest(void);
  65. Boolean     TimeoutStallRequest(void);
  66. Boolean     TimeoutDelayRequest(void);
  67. void         USBSetBaudRate(UInt32 baudRate);
  68. void         USBSetLineCoding(LineParms Line_Coding);
  69. void         USBSetControlLineState(void);
  70. void         USBSetDTRState(Boolean state);
  71. void         USBSetRTSState(Boolean state);
  72. void         USBSendBreak(Boolean state);
  73. void         USBSetCloseDTR(void);
  74. UInt8         USBGetDCDValue(void);
  75. void         modemDriverEntry(USBDeviceRef device, USBDeviceDescriptor *desc);
  76. static void InitializePB(USBPB *pb, USBDeviceRef ref, USBCompletion handler);
  77. void         readCompletion(USBPB *pb);
  78. void         USBStartReadPolling();
  79. void         USBStopReadPolling(void);
  80. void         writeCompletion(USBPB *pb);
  81. OSStatus     USBSerialWrite(IOParam *pb);
  82. void         KillUSBIO(void);
  83. void         InitLineCoding(LineParms Line_Coding);
  84. void         DoDelay(void);
  85. static void delayHandler(USBPB *pb);
  86. void         ClearDevice(void);
  87. static void stallHandler(USBPB *pb);
  88.  
  89. #if ((DebugOn > 0) && (LogOn > 0))
  90. UInt8         Asciify(UInt8 i);
  91. void         USBLogData(UInt8 Dir, UInt32 Count, UInt8 *buf);
  92. #endif
  93.  
  94. #endif
  95.